home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / revolvePreset.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.2 KB  |  91 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Mar. 14, 1997
  22. //  Author:         laf
  23. //
  24. //  Description:
  25. //      The revolvePreset() procedure executes a revolve operation on each 
  26. //        selected object.
  27. //
  28.  
  29. global proc revolvePreset( int $doHistory, int $outputPolys,
  30.                            int $partialCrvRange, float $startSweep,
  31.                            float $endSweep, int $useTol, float $tol,
  32.                            int $degree, int $numSegments, int $useLocalPivot,
  33.                            float $axisX, float $axisY, float $axisZ,
  34.                            float $pivotX, float $pivotY, float $pivotZ )
  35. {
  36.     // Get a list of curves to revolve and execute the revolve cmd on each.
  37.     // Allowable curves: nurbsCurves, isoparms, cos, surf edges
  38.     //
  39.     global int $gSelectNurbsCurvesBit;
  40.     global int $gSelectIsoparmsBit;
  41.     global int $gSelectCurvesOnSurfacesBit;
  42.     global int $gSelectSurfaceEdgeBit;
  43.     global int $gSelectMeshEdge;
  44.  
  45.     // Piece together the revolve command
  46.     //
  47.     string $cmd;
  48.     $cmd = ( "revolve " + 
  49.              " -ch " + $doHistory + " -po " + $outputPolys +
  50.              " -rn " + $partialCrvRange + " -ssw " + $startSweep  +
  51.              " -esw " + $endSweep  + " -ut " + $useTol + " -tol " + $tol +
  52.              " -degree " + $degree  + " -s " + $numSegments  +
  53.              " -ulp " + $useLocalPivot +
  54.              " -ax " + $axisX + " " + $axisY +  " " + $axisZ );
  55.  
  56.     if( ! $useLocalPivot ) {
  57.         $cmd = $cmd + " -p " + $pivotX + " " + $pivotY +  " " + $pivotZ;
  58.     }
  59.  
  60.     string $curveList[] = `filterExpand -ex true -sm $gSelectMeshEdge -sm $gSelectNurbsCurvesBit -sm $gSelectIsoparmsBit -sm $gSelectCurvesOnSurfacesBit -sm $gSelectSurfaceEdgeBit`;
  61.  
  62.     if( size($curveList) > 0 ) {
  63.         $cmd += " %s;";
  64.         string $revolveResults[] = executeForEachObject( $curveList, $cmd );
  65.         if( (size($revolveResults)) == 0 ) {
  66.             error("Revolve: Failed on the selected objects.");
  67.         }
  68.         else {
  69.             // Select all the results with one select command.  Note that only
  70.             // resulting surfaces are selected, not dependency nodes.
  71.             //
  72.             string $selectString;
  73.             $selectString = "select ";
  74.             int $i;
  75.  
  76.             int $numResults = size($revolveResults);
  77.             for( $i = 0; $i < $numResults; $i ++ ) {
  78.                 $selectString += $revolveResults[$i];
  79.                 $selectString += " ";
  80.             }
  81.             $selectString += ";";
  82.             select -cl;
  83.             eval($selectString);
  84.         }
  85.     }
  86.     else {
  87.         error( "Revolve: No valid items selected." );
  88.     }
  89. }
  90.  
  91.